'''
Created on 29/09/2014

@author: David
'''

class Pcb:
    def __init__(self,pc,dmemfinal,pid, quantum, prioridad):
        self.memInicial = pc
        self.dirMemFinal = dmemfinal
        self.programCounter = pc
        self.pid = pid
        self.quantum = quantum
        self.estado = 'new'
        self.prioridad = prioridad
    
    def getPrioridad(self):
        return self.prioridad
    
    def getPc(self):
        return self.programCounter

    def setPc(self, n):
        self.programCounter = n

    def getDirMemfinal(self):
        return self.dirMemFinal
    
    def getPid(self):
        return self.pid
    
    def asignarParametros(self,pc, dirm, pid, quantum, prioridad):
        self.memInicial = pc
        self.dirMemFinal = dirm
        self.programCounter= pc
        self.estado = "new"
        self.quantum =quantum
        self.prioridad = prioridad
    
    def reset(self):
        self.dirMemFinal = None
        self.programCounter = None
        self.estado = "terminated"
        
    def getQuantum(self):
        return self.quantum
    
    def setQuantum(self,n):
        self.quantum = n
    
    def getDirMemInicial(self):
        return self.memInicial
    
    def cantDeIntruccionesRestantes(self):
        return (self.dirMemFinal - self.programCounter)
    
    def getProgramCounter(self):
        return self.programCounter